Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 2 - Control Manager Reference / Control Manager Functions
Handling Events in Controls /


HandleControlKey

NEW WITH THE APPEARANCE MANAGER

Sends a keyboard event to a control with keyboard focus.

pascal SInt16 HandleControlKey (
                     ControlHandle inControl,
                     SInt16 inKeyCode,
                     SInt16 inCharCode,
                     SInt16 inModifiers);
inControl
On input, a handle to the control that currently has keyboard focus.
inKeyCode
The virtual key code, derived from the event structure. This value represents the key pressed or released by the user. It is always the same for a specific physical key on a particular keyboard regardless of which modifier keys were also pressed.
inCharCode
A particular character, derived from the event structure. The value that is generated depends on the virtual key code, the state of the modifier keys, and the current 'KCHR' resource.
inModifiers
A constant from the modifiers field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted.
function result
Returns the part code that was hit during the keyboard event; see "Control Part Code Constants".
DISCUSSION
If you have determined that a keyboard event has occurred in a given window, before calling the HandleControlKey function, call GetKeyboardFocus to get the handle to the control that currently has keyboard focus. The HandleControlKey function passes the values specified in its inKeyCode, inCharCode, and inModifiers parameters to control definition functions that set the kControlSupportsFocus feature bit.

SEE ALSO
"Appearance Manager Gestalt Selector Constants".


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998